﻿/******************************************************************************
* File description: ZBMaintenance.qml
* Function: 转靶维护校正页面
* Current Version: 1.1
* Author: 陈乃瑞
* Date: 2025-07-01
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Layouts 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Controls 2.12
import QtMultimedia 5.14

import "../animation/shiftingAnimation"

Rectangle{
    id: root
    //    title: "维护校正"
    width: parent.width
    height:  parent.height
    color: "white"
    radius: 12
    //    minimumWidth: 1430*dp
    //    minimumHeight: 860*dp
    //    maximumWidth: 1430*dp
    //    maximumHeight: 860*dp
    property int flagwh: 1
    property int flagcs: 1
    property int flagwc: 1
    property int gdwh: 1
    property int gdcs: 1
    property int gdwc: 1
    onVisibleChanged: {

    }

    Connections{  // qmlre
        target: CSignal
        onRefCommunicationLog:{
            logtab.setData(CMaintenance.getLog())
        }
        onZbxpGetAir:{
            zbxpyl.setText(airValue)
        }
        onZbZZ:{
            zbzzbs.setText(wz)
        }
        onZbXZ:{
            zbxzbs.setText(wz)
        }
        onZbKG:{
            zbkgbs.setText(wz)
        }
        onZbHX:{
            zbhxbs.setText(wz)
        }
        onZbXPDJ:{
            zbxpdjbs.setText(wz)
        }
    }
    Connections{  // qmlre
        target: CMaintenance
        onDellog:{
            logtab.setData(CMaintenance.getLog())
        }
    }
    Connections{
        target: CSignal
        onSendResetMsg:{
            if(status==="0"){
                maintenanceToast.show("复位完成",0)
            }
            else if(status==="1"){
                maintenanceToast.show("正在进行复位,请耐心等待",2)
            }
        }
        onSendTargetDelivery:{
            qfbs.setText(step)
        }
        onGetSuctionCupPressure:{
            xpqyyl.setText(suctioncupValue)
        }
        onGetMotorPosition:{
            kgbs.setText(motorPos)
        }
        onGetScrewCapInfo:{
            ggzs.setText(speed)
            ggbs.setText(step)
        }
        onTargetGasPumpValue:{
            zbqdyl.setText(value)
        }
        onTargetPadPumpValue:{
            zbxpylss.setText(yl)
        }
    }

    CustomPopupBoxWarning{
        id: qdhfcs
        box_text: "确认恢复初始状态吗?"
        onAccepted: {

        }
    }
    CustomPopupBoxWarning{
        id: qdfw
        box_text: "确认复位吗?"
        onAccepted: {
            CMaintenance.reset("0","10","")
        }
    }
    CustomPopupBoxWarning{
        id: qdxf
        box_text: "确认数据下发吗?"
        onAccepted: {
            CMaintenance.saveData(3)
        }
    }
    // 主布局
    Rectangle{
        x:30*dp
        y:20*dp
        width: parent.width-2*x
        height: parent.height-2*x

        // 上边 ==========================================
        Item{
            id: layout_top
            height: 180*dp; width: parent.width
            CustomButton{
                width: 100*dp
                height: 100*dp
                y: 20*dp
                title: "恢复初始"
                icon_color: "#56BD6C"
                button_color: isHovered? "#d9d9d9":"#F2F2F2"
                iconDirect: 1
                button_icon:"qrc:/picture/bt_hfcs.png"
                icon_size:33*dp
                onReleased: {
                    qdhfcs.show()
                }
            }
            CustomButton{
                width: 100*dp
                height: 100*dp
                x: 130*dp
                y: 20*dp
                title: "复位"
                icon_color: "#FFA200"
                button_color: isHovered? "#d9d9d9":"#F2F2F2"
                iconDirect: 1
                button_icon:"qrc:/picture/bt_fw.png"
                icon_size:33*dp
                onReleased: {
                    qdfw.show()
                }
                CustomTooltip{
                    visible: parent.isHovered
                    text: "复位到电机原点"
                }
            }
            CustomButton{
                width: 100*dp
                height: 100*dp
                x: 260*dp
                y: 20*dp
                title: "下发"
                icon_color: "#1677FF"
                button_color: isHovered? "#d9d9d9":"#F2F2F2"
                iconDirect: 1
                button_icon:"qrc:/picture/phwh_xf.png"
                icon_size:33*dp
                onReleased: {
                    qdxf.show()
                }
            }
            CustomButton{
                width: 100*dp
                height: 100*dp
                x: 390*dp
                y: 20*dp
                title: "状态获取"
                icon_color: "#1677FF"
                button_color: isHovered? "#d9d9d9":"#F2F2F2"
                iconDirect: 1
                button_icon:"qrc:/picture/phwh_zthq.png"
                icon_size:33*dp
                onReleased: {
                    statepop.show()
                }
            }
            Rectangle{
                width: parent.width*0.38
                height: parent.height
                x: parent.width*0.62
                border.color: "#B8B7B5"
                color: "#E0E6E9"
//                Image {
//                    id: pic1
//                    source: "qrc:/picture/glfb.png"
//                    fillMode: Image.PreserveAspectFit
//                    width: parent.width
//                    height: parent.height
//                }

                ShiftingCanvas{
                    anchors.centerIn: parent
                    width: Math.min(parent.width, parent.height*1.4)
                    height: Math.min(parent.height, parent.width * 0.8)
                    onVisibleChanged: {
                        if(visible){
                            startAnimation()
                        }else{
                            stopAnimation()
                        }
                    }
                }
                //                Rectangle{
                //                    x:20*dp
                //                    y:10*dp
                //                    Text {
                //                        text: qsTr("示意图")
                //                        font.bold: true
                //                        font.pixelSize: config.fontsize + 3*dp
                //                    }
                //                }
            }
        }
        // 下边
        Rectangle{
            id: layout_buttom
            y: layout_top.height + 10*dp
            width: parent.width
            height: parent.height - y
            radius: 10*dp
            border.color: "#B8B7B5"

            // 左半场
            ScrollView{
                y:10*dp
                id: scrollView
                width: parent.width*0.66
                height: parent.height-20*dp
                clip: true

                Column{
                    id: columnLayout
                    x:10*dp
                    y:40*dp
                    width: parent.width - 20*dp
                    height: parent.height-40*dp
                    spacing: 0*dp
                    Rectangle{
                        x:20*dp
                        radius: 8
                        border.color: "#DEDEDE"  // 边框颜色
                        border.width: 1
                        //                        y:150*dp
                        width:  scrollView.width-40*dp
                        height: 60*dp
                        Text {
                            x:20*dp
                            text: qsTr("维护")
                            font.bold: true
                            font.pixelSize: 20
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        PushButton{
                            x:scrollView.width-120*dp
                            y:1*dp
                            width: 36*dp
                            height: 28*dp
                            icon_height: 28*dp
                            icon_width: 36*dp
                            anchors.verticalCenter: parent.verticalCenter
                            button_icon:{
                                if(isHover){
                                    return "qrc:/picture/ygd.png"
                                }else{
                                    if(gdwh===0){
                                        return "qrc:/picture/wgd.png"
                                    }else{
                                        "qrc:/picture/ygd.png"
                                    }
                                }
                            }
                            onReleased: {
                                if(gdwh===0){
                                    gdwh=1
                                }else{
                                    gdwh=0
                                }
                            }
                            CustomTooltip{
                                visible: parent.isHover
                                text: "固定"
                            }
                        }
                        PushButton{
                            x:scrollView.width-80*dp
                            y:1*dp
                            width: 36*dp
                            height: 28*dp
                            icon_height: 28*dp
                            icon_width: 36*dp
                            anchors.verticalCenter: parent.verticalCenter
                            button_icon:flagwh===1?"qrc:/picture/xs.png":"qrc:/picture/xx.png"
                            onReleased: {
                                if(flagwh===1){
                                    if(gdwh===1){
                                        return
                                    }
                                    flagwh=0
                                }else{
                                    flagwh=1
                                    if(gdcs===0){
                                        flagcs=0
                                    }
                                    if(gdwc===0){
                                        flagwc=0
                                    }
                                }
                            }
                        }
                    }
                    Rectangle{
                        visible: flagwh===1
                        x:20*dp
                        //                        y:200*dp
                        width: scrollView.width-40*dp
                        height: 220*dp
                        color: "#F9F9F9"
                        CustomDoubleButton{
                            title: "夹爪"
                            name1: "夹紧"
                            name2: "松开"
                            x:20*dp
                            y:20*dp
                            width: (parent.width-120*dp)/5-22*dp
                            onBt1: {
                                CMaintenance.maintenanceAction(title+name1)
                                CAnimationShifting.openClamp()
                            }
                            onBt2: {
                                CMaintenance.maintenanceAction(title+name2)
                                CAnimationShifting.closeClamp()
                            }
                        }
                        CustomFourButton{
                            title: "旋盖夹爪"
                            name1: "靶材罐夹紧"
                            name2: "靶材罐松开"
                            name3: "原点夹紧"
                            name4: "原点松开"
                            x:(parent.width-120*dp)/5+18*dp
                            y:20*dp
                            width: (parent.width-120*dp)/5*2+86*dp
                            onBt1: {
                                CMaintenance.maintenanceAction(title+name1)
                                CAnimationShifting.baCaiGuaiJiaJin()
                            }
                            onBt2: {
                                CMaintenance.maintenanceAction(title+name2)
                                CAnimationShifting.baCaiGuaiSongKai()
                            }
                            onBt3: {
                                CMaintenance.maintenanceAction(title+name3)
                                CAnimationShifting.yuanDianJiaJin()
                            }
                            onBt4: {
                                CMaintenance.maintenanceAction(title+name4)
                                CAnimationShifting.yuanDianSongKai()
                            }
                        }
                        CustomDoubleButton{
                            title: "吸盘1"
                            name1: "打开"
                            name2: "关闭"
                            x:(parent.width-120*dp)/5*3+124*dp
                            y:20*dp
                            width: (parent.width-120*dp)/5-22*dp
                            onBt1: {
                                CMaintenance.maintenanceAction(title+name1)
                            }
                            onBt2: {
                                CMaintenance.maintenanceAction(title+name2)
                            }
                        }
                        CustomDoubleButton{
                            title: "吸盘2"
                            name1: "打开"
                            name2: "关闭"
                            x:(parent.width-120*dp)/5*4+122*dp
                            y:20*dp
                            width: (parent.width-120*dp)/5-22*dp
                            onBt1: {
                                CMaintenance.maintenanceAction(title+name1)
                                CAnimationShifting.zQiGangUp()
                            }
                            onBt2: {
                                CMaintenance.maintenanceAction(title+name2)
                                CAnimationShifting.zQiGangDown()
                            }
                        }
                        CustomDoubleButton{
                            title: "Z轴气缸"
                            name1: "上升"
                            name2: "下降"
                            x:20*dp
                            y:120*dp
                            width: (parent.width-120*dp)/5-22*dp
                            onBt1: {
                                CMaintenance.maintenanceAction(title+name1)
                                CAnimationShifting.zQiGangUp()
                            }
                            onBt2: {
                                CMaintenance.maintenanceAction(title+name2)
                                CAnimationShifting.zQiGangDown()
                            }
                        }
                        CustomFourButton{
                            title: "旋盖动作及位置"
                            name1: "开盖"
                            name2: "关盖"
                            name3: "靶材罐位置"
                            name4: "初始位置"
                            x:(parent.width-120*dp)/5+18*dp
                            y:120*dp
                            width: (parent.width-120*dp)/5*2+86*dp
                            onBt1: {
                                CMaintenance.maintenanceAction(title+name1)
                                CAnimationShifting.kaiGai()
                            }
                            onBt2: {
                                CMaintenance.maintenanceAction(title+name2)
                                CAnimationShifting.guanGai()
                            }
                            onBt3: {
                                CMaintenance.maintenanceAction(title+name3)
                                CAnimationShifting.baCaiGuanWeiZhi()
                            }
                            onBt4: {
                                CMaintenance.maintenanceAction(title+name4)
                                CAnimationShifting.chuShiWeiZhi()
                            }
                        }
                    }
                    Rectangle{
                        height: 10*dp
                        width: parent.width
                        x:0*dp
                    }
                    Rectangle{
                        x:20*dp
                        //                        y:150*dp
                        width:  scrollView.width-40*dp
                        height: 60*dp
                        radius: 8
                        border.color: "#DEDEDE"  // 边框颜色
                        border.width: 1
                        Text {
                            x:20*dp
                            text: qsTr("参数校正")
                            font.bold: true
                            font.pixelSize: 20
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        PushButton{
                            x:scrollView.width-120*dp
                            y:1*dp
                            width: 36*dp
                            height: 28*dp
                            icon_height: 28*dp
                            icon_width: 36*dp
                            anchors.verticalCenter: parent.verticalCenter
                            button_icon:{
                                if(isHover){
                                    return "qrc:/picture/ygd.png"
                                }else{
                                    if(gdcs===0){
                                        return "qrc:/picture/wgd.png"
                                    }else{
                                        "qrc:/picture/ygd.png"
                                    }
                                    //                                    gddb===0?"qrc:/picture/wgd.png":"qrc:/picture/ygd.png"
                                }
                            }
                            onReleased: {
                                if(gdcs===0){
                                    gdcs=1
                                }else{
                                    gdcs=0
                                }
                            }
                            CustomTooltip{
                                visible: parent.isHover
                                text: "固定"
                            }
                        }
                        PushButton{
                            x:scrollView.width-80*dp
                            y:1*dp
                            width: 36*dp
                            height: 28*dp
                            icon_height: 28*dp
                            icon_width: 36*dp
                            anchors.verticalCenter: parent.verticalCenter
                            button_icon:flagcs===1?"qrc:/picture/xs.png":"qrc:/picture/xx.png"
                            onReleased: {
                                if(flagcs===1){
                                    if(gdcs===1){
                                        return
                                    }
                                    flagcs=0
                                }else{
                                    flagcs=1
                                    if(gdwh===0){
                                        flagwh=0
                                    }
                                    if(gdwc===0){
                                        flagwc=0
                                    }
                                }
                            }
                        }
                    }
                    Rectangle{
                        visible: flagcs===1
                        x:20*dp
                        color: "#F9F9F9"
                        //                        y:200*dp
                        width: scrollView.width-40*dp
                        height: 620*dp
                        Rectangle{
                            x:0*dp
                            y:20*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomComboBox{
                                id:zbxp
                                title: "吸盘气压"
                                x:10*dp
                                y:20*dp
                                titleWidth: 80*dp
                                editWidth: 100*dp
                                model: ["开阀门","关阀门"]
                            }
                            CustomComboBox{
                                id:zbxplx
                                title: "吸盘"
                                x:190*dp
                                y:20*dp
                                titleWidth: 60*dp
                                editWidth: 100*dp
                                model: ["吸盘1","吸盘2"]
                            }
                            CustomInputText{
                                id:zbxpyl
                                x:360*dp
                                y:20*dp
                                title: "压力值"
                                titleWidth: 80*dp
                                editWidth: 80*dp
                            }
                            CustomButton{
                                x:parent.width-220*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "读取"
                                onReleased: {
                                    CMaintenance.getXpAir(zbxp.getText(),zbxplx.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-110*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "写入"
                                onReleased: {
                                    CMaintenance.setXpAir(zbxp.getText(),zbxpyl.getText(),zbxplx.getText())
                                }
                            }
                        }
                        Rectangle{
                            x:0*dp
                            y:100*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomComboBox{
                                id:zbzz
                                title: "Z轴电机位置"
                                x:10*dp
                                y:20*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["原始位置","吸靶位置","放靶位置","检测开盖是否成功位置","活度位置"]
                            }
                            CustomInputText{
                                id:zbzzbs
                                x:230*dp
                                y:20*dp
                                title: "步数"
                                titleWidth: 80*dp
                                editWidth: 80*dp
                            }
                            CustomButton{
                                x:parent.width-330*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "读取"
                                onReleased: {
                                    CMaintenance.getZbZZ(zbzz.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-220*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "写入"
                                onReleased: {
                                    CMaintenance.setZbZZ(zbzz.getText(),zbzzbs.getText())
                                }
                            }

                            CustomButton{
                                x:parent.width-110*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "执行"
                                onReleased: {
                                    CMaintenance.runZbZZ(zbzz.getText(),zbzzbs.getText())
                                }
                            }
                        }
                        Rectangle{
                            x:0*dp
                            y:180*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomComboBox{
                                id:zbxz
                                title: "X轴电机位置"
                                x:10*dp
                                y:20*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["原始位置","开关盖位置","吸靶位置1","放靶位置1","活度位置1","吸靶位置2","放靶位置2","活度位置2"]
                            }
                            CustomInputText{
                                id:zbxzbs
                                x:230*dp
                                y:20*dp
                                title: "步数"
                                titleWidth: 80*dp
                                editWidth: 80*dp
                            }
                            CustomButton{
                                x:parent.width-330*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "读取"
                                onReleased: {
                                    CMaintenance.getZbXZ(zbxz.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-220*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "写入"
                                onReleased: {
                                    CMaintenance.setZbXZ(zbxz.getText(),zbxzbs.getText())
                                }
                            }

                            CustomButton{
                                x:parent.width-110*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "执行"
                                onReleased: {
                                    CMaintenance.runZbXZ(zbxz.getText(),zbxzbs.getText())
                                }
                            }
                        }
                        Rectangle{
                            x:0*dp
                            y:260*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomComboBox{
                                id:zbkg
                                title: "开盖电机位置"
                                x:10*dp
                                y:20*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["开盖","关盖"]
                            }
                            CustomInputText{
                                id:zbkgbs
                                x:230*dp
                                y:20*dp
                                title: "步数"
                                titleWidth: 80*dp
                                editWidth: 80*dp
                            }
                            CustomButton{
                                x:parent.width-330*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "读取"
                                onReleased: {
                                    CMaintenance.getZbKG(zbkg.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-220*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "写入"
                                onReleased: {
                                    CMaintenance.setZbKG(zbkg.getText(),zbkgbs.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-110*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "执行"
                                onReleased: {
                                    CMaintenance.runZbKG(zbkg.getText(),zbkgbs.getText())
                                }
                            }
                        }
                        Rectangle{
                            x:0*dp
                            y:340*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomComboBox{
                                id:zbhx
                                title: "活性检测位置"
                                x:10*dp
                                y:20*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["原始位置","下移位置"]
                            }
                            CustomInputText{
                                id:zbhxbs
                                x:230*dp
                                y:20*dp
                                title: "步数"
                                titleWidth: 80*dp
                                editWidth: 80*dp
                            }
                            CustomButton{
                                x:parent.width-330*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "读取"
                                onReleased: {
                                    CMaintenance.getZbHX(zbhx.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-220*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "写入"
                                onReleased: {
                                    CMaintenance.setZbHX(zbhx.getText(),zbhxbs.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-110*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "执行"
                                onReleased: {
                                    CMaintenance.runZbHX(zbhx.getText(),zbhxbs.getText())
                                }
                            }
                        }
                        Rectangle{
                            x:0*dp
                            y:420*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomComboBox{
                                id:zbxpdj
                                title: "吸盘电机位置"
                                x:10*dp
                                y:20*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["原始位置","活度位置1","活度位置2"]
                            }
                            CustomInputText{
                                id:zbxpdjbs
                                x:230*dp
                                y:20*dp
                                title: "步数"
                                titleWidth: 80*dp
                                editWidth: 80*dp
                            }
                            CustomButton{
                                x:parent.width-330*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "读取"
                                onReleased: {
                                    CMaintenance.getZbXPDJ(zbxpdj.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-220*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "写入"
                                onReleased: {
                                    CMaintenance.setZbXPDJ(zbxpdj.getText(),zbxpdjbs.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-110*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "执行"
                                onReleased: {
                                    CMaintenance.runZbXPDJ(zbxpdj.getText(),zbxpdjbs.getText())
                                }
                            }
                        }
                        Rectangle{
                            x:0*dp
                            y:500*dp
                            width: parent.width
                            height: 100*dp
                            color: "transparent"
                            CustomComboBox{
                                id:zbrd
                                title: "蠕动泵位置"
                                x:10*dp
                                y:20*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["吸液","打液"]
                            }
                            CustomInputText{
                                id:zbrdsd
                                x:250*dp
                                y:20*dp
                                title: "速度(100-700r/m)"
                                titleWidth: 120*dp
                                editWidth: 80*dp
                                onTextChanged: {
                                    var num = parseInt(zbrdsd.getText());
                                    if(num>700){
                                        rdpop.show()
                                        zbrdsd.setText("")
                                    }
                                }
                            }
                            CustomInputText{
                                id:zbrdsj
                                x:240*dp
                                y:70*dp
                                title: "时间(s)"
                                titleWidth: 130*dp
                                editWidth: 80*dp
                            }
                            CustomButton{
                                x:parent.width-220*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "执行"
                                onReleased: {
                                    CMaintenance.runZbRD(zbrd.getText(),zbrdsd.getText(),zbrdsj.getText())
                                }
                            }
                            CustomButton{
                                x:parent.width-110*dp
                                y:20*dp
                                width: 100*dp
                                defaultMode1: true
                                title: "停止"
                                onReleased: {
                                    CMaintenance.runZbRD("停止",zbrdsd.getText(),zbrdsj.getText())
                                }
                            }
                        }

                    }
                    Rectangle{
                        height: 10*dp
                        x:0*dp
                        width: parent.width
                    }
                    Rectangle{
                        x:20*dp
                        //                        y:150*dp
                        width:  scrollView.width-40*dp
                        height: 60*dp
                        radius: 8
                        border.color: "#DEDEDE"  // 边框颜色
                        border.width: 1
                        Text {
                            x:20*dp
                            text: qsTr("无参校正")
                            font.bold: true
                            font.pixelSize: 20
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        PushButton{
                            x:scrollView.width-120*dp
                            y:1*dp
                            width: 36*dp
                            height: 28*dp
                            icon_height: 28*dp
                            icon_width: 36*dp
                            anchors.verticalCenter: parent.verticalCenter
                            button_icon:{
                                if(isHover){
                                    return "qrc:/picture/ygd.png"
                                }else{
                                    if(gdwc===0){
                                        return "qrc:/picture/wgd.png"
                                    }else{
                                        "qrc:/picture/ygd.png"
                                    }
                                    //                                    gddb===0?"qrc:/picture/wgd.png":"qrc:/picture/ygd.png"
                                }
                            }
                            onReleased: {
                                if(gdwc===0){
                                    gdwc=1
                                }else{
                                    gdwc=0
                                }
                            }
                            CustomTooltip{
                                visible: parent.isHover
                                text: "固定"
                            }
                        }
                        PushButton{
                            x:scrollView.width-80*dp
                            y:1*dp
                            width: 36*dp
                            height: 28*dp
                            icon_height: 28*dp
                            icon_width: 36*dp
                            anchors.verticalCenter: parent.verticalCenter
                            button_icon:flagwc===1?"qrc:/picture/xs.png":"qrc:/picture/xx.png"
                            onReleased: {
                                if(flagwc===1){
                                    if(gdwc===1){
                                        return
                                    }
                                    flagwc=0
                                }else{
                                    flagwc=1
                                    if(gdwh===0){
                                        flagwh=0
                                    }
                                    if(gdcs===0){
                                        flagcs=0
                                    }
                                }
                            }
                        }
                    }
                    Rectangle{
                        visible: flagwc===1
                        x:20*dp
                        color: "#F9F9F9"
                        //                        y:200*dp
                        width: scrollView.width-40*dp
                        height: 140*dp
                        Rectangle{
                            x:0*dp
                            y:20*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomComboBox{
                                id:qfbcs
                                title: "取放靶"
                                x:10*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["取靶","放靶","探测"]
                            }
                            CustomComboBox{
                                id:qfbwz
                                x:230*dp
                                title: "位置"
                                titleWidth: 100*dp
                                editWidth: 120*dp
                                model: ["靶材罐","溶靶瓶","检测瓶","开盖检测","活度检测位"]
                            }
                            CustomComboBox{
                                id:qfbxp
                                x:450*dp
                                title: "吸盘"
                                titleWidth: 60*dp
                                editWidth: 100*dp
                                model: ["吸盘1","吸盘2"]
                            }
                            CustomButton{
                                x:parent.width-110*dp
                                title: "执行"
                                width: 100*dp
                                defaultMode1: true
                                onReleased: {
                                    CMaintenance.runQFB(qfbcs.getText(),qfbwz.getText(),qfbxp.getText())
                                }
                            }
                        }
                        Rectangle{
                            x:0*dp
                            y:80*dp
                            width: parent.width
                            height: 40*dp
                            color: "transparent"
                            CustomInputText{
                                id:zbqdyl
                                title: "气道压力"
                                x:10*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                            }
                            CustomInputText{
                                id:zbxpylss
                                title: "吸盘压力"
                                x:230*dp
                                titleWidth: 100*dp
                                editWidth: 120*dp
                            }
                            CustomButton{
                                title: "获取"
                                width: 100*dp
                                x:parent.width-110*dp
                                defaultMode1: true
                                onReleased: {
                                    CMaintenance.getZBxpyl()
                                }
                            }
                        }
                    }
                    Rectangle{
                        x:0*dp
                        //                        y:50*dp
                        width: scrollView.width
                        height: 40*dp
                    }
                }
            }

            Rectangle{ // 中间的竖线
                x: parent.width*0.67
                width: 1*dp
                height: parent.height
                color: "#B8B7B5"
            }
            // 右半场
            Item{
                x: parent.width * 0.68
                width: parent.width * 0.31
                height: parent.height
                Rectangle{
                    y:20*dp; x: 20*dp
                    Text {
                        text: qsTr("通信日志")
                        font.bold: true
                        font.pixelSize: config.fontsize + 3*dp
                    }
                }
                PushButton{
                    x:parent.width-140*dp
                    y:20*dp
                    button_icon: "qrc:/picture/br_qc.png"
                    title: "清除"
                    width: 60*dp
                    text_color: "#1677FF"
                    icon_height: 20*dp
                    icon_width: 20*dp
                    onReleased: {
                        CMaintenance.delLog()
                    }
                }
                PushButton{
                    x:parent.width-70*dp
                    y:20*dp
                    button_icon: "qrc:/picture/bt_dc.png"
                    title: "导出"
                    width: 60*dp
                    text_color: "#1677FF"
                    icon_height: 20*dp
                    icon_width: 20*dp
                    onReleased: {
                        CMaintenance.exportLog()
                    }
                }
                Rectangle{
                    x: 20*dp
                    y:65*dp
                    color: "#B8B7B5"
                    width: parent.width-2*x
                    height: parent.height-70*dp
                    DataLog{
                        id:logtab
                    }
                }
            }
        }
    }

    Toast{
        id: maintenanceToast
        x: (parent.width-width) * 0.5
        y: 100*dp
    }

}
